package com.solar.etl.transform;

import org.dom4j.Element;

import bsh.EvalError;
import bsh.Interpreter;

import com.solar.etl.config.mapping.Field;
import com.solar.etl.spi.Itransform;

public class JavaTransForm implements Itransform{
	
	@Override
	public String transform(Field field, Element item) {
		String strScript=item.getTextTrim();
		Interpreter bsh=new Interpreter();
		String value=null;
		try {
			bsh.set("value", field.destValue);
			field.destValue=(String)bsh.eval(strScript);
		} catch (EvalError e) {
			e.printStackTrace();
		}
		return value;
	}

}
